package com.winapi.winapigateway;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import com.winapi.provider.DemoService;
import org.springframework.stereotype.Service;

@SpringBootApplication(exclude ={
        DataSourceAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class})
@EnableDubbo
@Service
@Slf4j
public class WinapiGatewayApplication {
@DubboReference
private DemoService demoService;

    public static void main(String[]args) {
        ConfigurableApplicationContext context = SpringApplication.run(WinapiGatewayApplication.class, args);
        WinapiGatewayApplication application = context.getBean(WinapiGatewayApplication.class);
        String result = application.doSayHello("world");
        System.out.println("result:" + result);
    }
        public String doSayHello(String name){return demoService.sayHello(name);}

}
